﻿Imports System.Data.OleDb
Public Class AddNewQuote
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub btn_addQuote_Click(sender As Object, e As EventArgs) Handles btn_addQuote.Click
        Dim oleDbConn As New OleDb.OleDbConnection(ConfigurationManager.ConnectionStrings("TwilightConn").ConnectionString)
        Dim SqlString As String = "INSERT INTO Quotes([Quote],[Character],[Book],TwiWriter) VALUES(@f1,@f2,@f3,@f4)"
        Dim cmd As OleDbCommand = New OleDbCommand(SqlString, oleDbConn)

        cmd.CommandType = CommandType.Text
        cmd.Parameters.AddWithValue("@f1", tb_Quote.Text)
        cmd.Parameters.AddWithValue("@f2", tb_charQuote.Text)
        cmd.Parameters.AddWithValue("@f3", ddl_bookFromQuote.SelectedValue)
        cmd.Parameters.AddWithValue("@f4", User.Identity.Name)
        oleDbConn.Open()
        cmd.ExecuteNonQuery()
        cmd.Dispose()
        oleDbConn.Close()
        oleDbConn.Dispose()
        Response.Redirect("NewQuoteConfirmation.aspx")
    End Sub
End Class